how to deploy v2ray client with jenkins on k8s

at first, you should learn relevant knowledge from here.

next, execute v2ray.sh in jenkins. for example, v2ray.sh latest(latest comes from jenkins variable).

#v2ray.sh for jenkins
#!/bin/sh
if [ $# -eq 0 ];then
    echo "No arguments supplied"
    exit 1
fi
cat > v2ray.yaml.v2 << EOF
apiVersion: v1
kind: Pod
metadata:
  name: v2ray
spec:
  nodeName: node
  containers:
    - name: v2ray
      image: v2ray/official:$1
      volumeMounts:
      - name: v2ray
        mountPath: /root/v2ray/config.json
        subPath: config.json
      imagePullPolicy: IfNotPresent
      command: [ "/bin/sh" ]
      args: ["-c","v2ray -config=/root/v2ray/config.json"]
  volumes:
  - name: v2ray
    configMap:
      name: v2ray
EOF
kubectl apply -f v2ray.yaml.v2
rm -f v2ray.yaml.v2

references: https://en.wikipedia.org/wiki/Here_document